<template>
  <div>
    <div><search-item :child-data="multipleSelection" v-on:searchParams="getSearchParams"></search-item></div>
    <div class="mt20">
      <el-table
        v-loading="loading"
        element-loading-text="拼命加载中"
        :data="tableData"
        border
        size="mini"
        width="100%"
        @selection-change="handleSelectionChange"
      >
        <el-table-column
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column
          prop="id"
          label="课程ID"
          width="260"
        >
        </el-table-column>
        <el-table-column
          width="120"
          prop="account_bo"
          label="标题"
        >
        </el-table-column>
        <el-table-column
          prop="user_num_bo"
          label="讲师ID">
        </el-table-column>

        <el-table-column
          prop="nickname_bo"
          label="用户手机">
        </el-table-column>
        <el-table-column
          label="讲师姓名">
          <template slot-scope="scope">
            <span v-if="scope.row.type==1">购买课程</span>
            <span v-if="scope.row.type==2">购买短信</span>
            <span v-if="scope.row.type==3">打赏</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="course_num_bo"
          label="讲师昵称">
        </el-table-column>
        <el-table-column
          prop="order_time"
          width="150"
          label="经纪商">
          <template slot-scope="scope">
            {{scope.row.source==='1'?'PC':(scope.row.source==='2'?'Android':(scope.row.source==='3'?'IOS':'WEB'))}}
          </template>
        </el-table-column>
        <el-table-column
          prop="order_time"
          width="150"
          label="创建时间">
        </el-table-column>
        <el-table-column
          prop="order_time"
          width="150"
          label="预计开始时间">
        </el-table-column>
        <el-table-column
          prop=""
          width="150"
          label="实际开课时间">
        </el-table-column>
        <el-table-column
          prop=""
          width="150"
          label="课程结束时间">
        </el-table-column>
        <el-table-column
          prop=""
          label="课程状态">
        </el-table-column>
        <el-table-column
          prop=""
          label="结算状态">
        </el-table-column>
        <el-table-column
          prop=""
          label="下单数">
        </el-table-column>
        <el-table-column
          prop=""
          label="准确率">
        </el-table-column>
        <el-table-column
          prop=""
          width="150"
          label="学员跟单次数">
        </el-table-column>
        <el-table-column
          prop=""
          width="150"
          label="学员跟单金额">
        </el-table-column>
        <el-table-column
          prop=""
          width="150"
          label="讲师盈亏金额">
        </el-table-column>
        <el-table-column
          prop=""
          label="课程单价">
        </el-table-column>
        <el-table-column
          prop=""
          label="听课人次">
        </el-table-column>
        <el-table-column
          prop=""
          width="150"
          label="实收佣金珍珠">
        </el-table-column>
        <el-table-column
          prop=""
          label="佣金比例">
        </el-table-column>
        <el-table-column
          prop=""
          width="150"
          label="发放佣金珍珠">
        </el-table-column>
        <el-table-column
          prop=""
          label="实收赏金">
        </el-table-column>
        <el-table-column
          prop=""
          label="赏金比例">
        </el-table-column>
        <el-table-column
          prop=""
          width="150"
          label="已发放赏金">
        </el-table-column>
        <el-table-column
          prop=""
          label="课程收入">
        </el-table-column>
        <el-table-column
          prop=""
          label="备注">
        </el-table-column>
      </el-table>
    </div>
    <div class="block mt10 tc mb10">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :current-page.sync="page"
        :page-size="pageSize"
        layout="total, prev, pager, next"
        :total="total">
      </el-pagination>
      <br>
    </div>
    <!--弹窗-->
    <common-dialog title="对账" width="40%" :base-dialog="dialogFormVisible">
      <div slot="body">
        <div class="mt10">

        </div>
        <div class="tc mt20">
          <el-button @click="dialogFormVisible=false" size="medium">取消</el-button>
          <el-button type="primary" size="medium" @click="">确定</el-button>
        </div>
      </div>
    </common-dialog>
    <!--弹窗-->
  </div>
</template>
<script>
  import service from '@/service'
  import searchItem from './courseSearch';
  import commonDialog from "@/components/Common/CommonDialog";
  export default {
    data(){
      return {
        tableData:[],
        loading:true,
        page:1,
        pageSize:15,
        total:0,
        multipleSelection:[],   //选择框的选中数据
        dialogFormVisible:false
      }
    },
    created () {
      if(this.multipleSelection==null||this.multipleSelection.length==0){
        console.log('11111');
      }else {
        console.log('222222');
      }
    },
    mounted(){
      this.getQueryDataList();
    },
    methods:{
      getSearchParams(params){
        this.totalParams = params;
        this.getQueryDataList();
      },
      async  getQueryDataList(page=1){
        let params = {
          //queryFiled:this.totalParams.userType,   //对应类型输入框
          //queryValue:this.totalParams.currentUserType,   //选择相应类型
          //transType:this.totalParams.courseType,  //课程状态
          //refundStatus:this.totalParams.mate,  //经纪商
          //source:this.totalParams.startAmountSum,   //跟单金额-起始值
          //startPearl:this.totalParams.endAmountSum,  //跟单金额-结束值
          //endPearl:this.totalParams.startCoursePrice,   //课程单价-起始值
          //startTime:this.totalParams.endCoursePrice,   //课程单价-结束值
          //endTime:this.totalParams.startPassengers,   //跟单人次-起始值
          //endTime:this.totalParams.endPassengers,   //跟单人次-结束值
          //endTime:this.totalParams.settlementState,   //结算状态
          //endTime:this.totalParams.startProfitLoss,   //盈亏金额-起始值
          //endTime:this.totalParams.endProfitLoss,   //盈亏金额-结束值
          //endTime:this.totalParams.startOpeningTime,   //开课时间-起始值
          //endTime:this.totalParams.endOpeningTime,   //开课时间-结束值
          page:page,
          pageSize:this.pageSize
        }
        //console.log(JSON.stringify(params));
        let res =await service.haiBeiServerTradeList(params);
        if(res.success){
          this.tableData=res.result.pageList;
          this.loading=false;
          this.page = res.result.page;
          this.total = res.result.nums;
          //this.currentTotalMoney = res.result.data;  统计当前筛选条件下，充值金额的总和
        }
      },
      handleCurrentChange(val){
        this.getQueryDataList();
      },
      handleSelectionChange(val){
        this.multipleSelection = val;
        //console.log(JSON.stringify(this.multipleSelection)
      }
    },
    components:{
      searchItem,
      commonDialog
    }

  }
</script>

